// 编程实现一维数组的增删改查
public class ArrayOpTest{
	public static void main(String[] args) {
		// 1.声明一个长度为5int类型的数组
		int[] arr1 = new int[5];
		//2.打印数组元素
		System.out.println("数组中的元素:");
		for (int i = 0; i < arr1.length ; i++ ) {
			System.out.print(arr1[i] + " ");
		}
		System.out.println();
		System.out.println("---------------------------------------");
		//2.将11，22，33，44赋值给数组的前四位
		// arr1[0] = 11;
		// arr1[1] = 22;
		// arr1[2] = 33;
		// arr1[3] = 44;
		for (int i = 0; i < arr1.length ; i++) {
			arr1[i] = (i + 1) * 11;               
		}
		System.out.println("数组中的元素:");
		for (int i = 0; i < arr1.length ; i++ ) {
			System.out.print(arr1[i] + " ");
		}
		System.out.println("---------------------------------------");
		//数组插入操作
		for (int i = 4;  i < arr1.length ; i-- ) {
			if (i > 0) {
				arr1[i] = arr1[i - 1];
			}else if (i == 0) {
				arr1[i] = 55;
			}
		}
		System.out.println("数组中的元素:");
		for (int i = 0; i < arr1.length ; i++ ) {
			System.out.print(arr1[i] + " ");
		}


		System.out.println("---------------------------------------");
		// 数组删除操作
		for (int i = 0; i <arr1.length - 1  ; i++  ) {
			arr1[i] = arr1[i + 1];
		}
		arr1[4] = 0;
		System.out.println("数组中的元素:");
		for (int i = 0; i < arr1.length ; i++ ) {
			System.out.print(arr1[i] + " ");
		}
		System.out.println("---------------------------------------");

	}
}